<%--
  Created by IntelliJ IDEA.
  User: zuozhongfei
  Date: 2020/5/28
  Time: 1:22 下午
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<html>
<head>
    <title>员工列表页面</title>

</head>

<body>
<%
    pageContext.setAttribute("ctp",request.getContextPath());
%>
<h1>员工列表</h1>

<table border="1" cellpadding="5" cellspacing="0">
    <tr>
        <th>ID</th>
        <th>lastName</th>
        <th>email</th>
        <th>gender</th>
        <th>departmentName</th>
        <th>Edit</th>
        <th>Delete</th>
    </tr>
    <c:forEach items="${requestScope.emps}" var="emp">
        <tr>
            <td>"${emp.id}"</td>
            <td>${emp.lastName}</td>
            <td>${emp.email}</td>
            <td>${emp.gender==0?"女":"男"}</td>
            <td>${emp.department.departmentName}</td>
            <td>
                <a href="${ctp}/emp/${emp.id}">Edit</a>
            </td>
            <td>
                <form id="deleteForm" action="${ctp}/emp/${emp.id}" method="post">
                    <input type="hidden" name="_method" value="delete">
                    <input type="submit" value="删除">
                </form>
            </td>
        </tr>
    </c:forEach>
</table>

<a href="${ctp}/toaddpage">添加员工</a>

</body>


</html>
